<?php
class validators_matchPasswords extends Zend_Validate_Abstract
{
	const NOT_MATCH = 'notMatch';

	protected $_messageTemplates = array(
		self::NOT_MATCH => "password confirmation doesn't match"
	);

	public function isValid($value, $context = null)
    {
        $value = (string) $value;
        $this->_setValue($value);

        if(is_array($context)) {
        	if(isset($context['password']) or isset($context['passwordConfirm'])) {
        		if($context['password'] == $context['passwordConfirm']) {
        			return true;
        		}
        	}
        }

        $this->_error(self::NOT_MATCH);
        return false;
    }
}